import {post,get, put} from "../utils/service"
//登录
export const userLoginApi = data =>{
    return post({
        url:"/login/userLogin?phone="+data.phone+"&password="+data.password
    })
}

//注册
export const userRegisterApi = data =>{
    return put({
        url:"/login/userRegister",data
    })
}
// 发送邮件
export const userforGotPwdApi = data =>{
    return get({
        url:"/email/mutEmail?phone="+data.phone+"&email="+data.email
    })
}
// 更新密码
export const updatePwdApi = data =>{
    return post({
        url:"/login/forgot?phone="+data.phone+"&email="+data.email+"&password="+data.password+"&code="+data.code
    })
}

// 轮播图

export const showSlideApi = data =>{
    return get({
        url:"/client/showSlide"
    })
}

// 图书

export const bookShowApi = data =>{
    return get({
        url:"/client/bookShow"
    })
}

// 查看更多
export const bookShowMoreApi = data =>{
    return get({
        url:`/client/showMore/${data}`
    })
}

// 图书详情bookDetail
export const bookDetailApi = data =>{
    return get({
        url:`/client/bookDetail/${data}`
    })
}
// 切换图书
export const changebookDetailApi = data =>{
    return get({
        url:`/client/bookDetail/${data}`
    })
}

// 添加购物车
export const addCartApi = data =>{
    return put({
        url:"/cart/add",data
    })
}

// 查看购物车
export const getUserCartApi = data =>{
    return get({
        url:`/cart/getUserCart/${data}`
    })
}
// 修改数量

export const updateCartApi = data =>{
    return put({
        url:"/cart/updateCart",data
    })
}

// 删除一条

export const deleteCartApi = data =>{
    return put({
        url:`/cart/deleteCart/${data.u_Id}/${data.b_Id}`
    })
}
// 批量删除
export const deleteCartListApi = data =>{
    return put({
        url:"/cart/deleteList",data
    })
}

// 获取用户地址
export const AddressApi = data =>{
    return get({
        url:`/client/address/${data}`
    })
}

// 删除地址

export const delAddressApi = data =>{
    return get({
        url:`/client/address/del/${data}`
    })
}

// 更新

export const updateAddressApi = data =>{
    return put({
        url:"/client/address/update",data
    })
}
// 添加
export const addAddressApi = data =>{
    return put({
        url:"/client/address/add",data
    })
}

// 修改用户个人信息

export const UpdateUserApi = data =>{
    return put({
        url:"/user/Update",data
    })
}

// 提交订单

export const addOrderApi = data =>{
    return put({
        url:"/cart/addOrder",data
    })
}

// 购买

export const addgoodsApi = data =>{
    return put({
        url:"/cart/addOne",data
    })
}

// 用户个人订单

export const ShowOrderApi = data =>{
    return get({
        url:`/order/getOrderByUserId/${data}`
    })
}
// 确认收货
export const ConfirmOfGoodsApi= data=>{
    return get({
        url:`/order/ConfirmOfGoods/${data.orderFId}/${data.orderStatus}`
    })
}
// 删除订单
export const delOrderApi=data=>{
    return get({
        url:`/order/delOrderOfGoods/${data}`
    })
}

// 搜索
export const searchApi=data=>{
    return get({
        url:`/client/search/${data}`
    })
}